package edu.sandau.b23015110.service;

import edu.sandau.b23015110.model.Student;
import edu.sandau.b23015110.repository.StudentRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class StudentService {

    @Autowired
    private StudentRepository studentRepository;

    public List<Student> findAll(Student student){
        return studentRepository.findAll(Example.of(student));
    }

    public  void deleteById(String id) {
        studentRepository.deleteById(id);
    }

    public void save(Student s) {
        studentRepository.save(s);
    }

    public  Student getReferenceById(String id) {
        return studentRepository.getReferenceById(id);
    }




}
